*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		FIGURES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"
		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/


*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** FIGURE A5
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	

use data/processed/data_1, clear 
keep if control_pure==1 |control_fincrisis==1 | control_dotcom==1 | control_black==1 
gen h_constrained=(constrained>3)
gen h_age=(age>48)

global controls 		ln_hhnetinc  ///
						ln_ofinwealth_lvl ln_retirewealth_lvl  ///
						ln_realestate_lvl realestJan20_NR		///
						ln_debt_lvl  debtJan20_NR ///
						stockinvestor riskshare_finwealth_Jan201 stockexperience ///
						i.agecat male married separated_divorced widowed ///	
						highschool some_college_associate_degree atleast_bachelor  ///
						mainearner_alone z_constrained self_empl retired unempl empl_other ///
						republican other_party NR_party  ///
						z_decisionmaker  ///
						i.region i.svydate i.treatment  	
					
		foreach x in del_spend20_usd_tr02 delhhnetinc_USD_tr02_qtr delhhnetinc_USD_tr02alt_qtr delretir_USD_tr02 delfinwealth_USD_tr02alt delretir_USD_tr02alt delofin_USD_tr02alt	delofin_USD_tr02 delhhnetinc_USD_tr02 delfinwealth_USD_tr02 {
				replace `x' = `x'/1000
		}		
			
		** BINSCATTERS 
			binscatter 	del_spend20_usd_tr02 /// 
						delretir_USD_tr02alt ///
						, line(lfit) controls(delofin_USD_tr02alt delhhnetinc_USD_tr02alt_qtr $controls) ///
						ylabel(-10(2)0, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in retirement wealth ($1000)", size(medsmall))  ///						
						saving(Figures/bin1a, replace) reportreg
						

			binscatter 	del_spend20_usd_tr02 /// 
						 delofin_USD_tr02alt ///
						, line(lfit) controls( delretir_USD_tr02alt delhhnetinc_USD_tr02alt_qtr $controls) ///
						ylabel(-10(2)0, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in other financial wealth ($1000)", size(medsmall))  ///	
						saving(Figures/bin2a, replace) reportreg
						
			binscatter 	del_spend20_usd_tr02 /// 
						 delfinwealth_USD_tr02alt ///
						, line(lfit) controls(  delhhnetinc_USD_tr02alt_qtr $controls) ///
						ylabel(-10(2)0, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in total financial wealth ($1000)", size(medsmall))  ///	
						saving(Figures/bin4a, replace) reportreg			
				
				
			binscatter 	del_spend20_usd_tr02 /// 
						 delhhnetinc_USD_tr02alt_qtr ///
						, line(lfit) controls(delofin_USD_tr02alt delretir_USD_tr02alt  $controls) ///
						ylabel(-10(2)0, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in household income ($1000)", size(medsmall))  ///	
						saving(Figures/bin3a, replace) reportreg
			
			graph combine Figures/bin1a.gph Figures/bin2a.gph Figures/bin4a.gph Figures/bin3a.gph, ///
				l1title("Expected spending growth ($1000)", size(small))
				
			graph export Figures/FigureA5.pdf, as(pdf) fontface("cmr10") replace
			graph export Figures/FigureA5.png, width(1600) replace		
						
	forvalues x = 1/4 {
			capture erase Figures/bin`x'a.gph
	}				
